package com.guo.core.framework.JDBCtest;

import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.jdbc.core.JdbcTemplate;


import javax.sql.DataSource;
import java.sql.Types;
import java.util.List;

/**
 * @projectName: 接口梳理
 * @package: com.guo.core.framework.JDBCtest
 * @className: ServiceImpl
 * @author: zhangcan30
 * @description: TODO
 * @date: 2023/12/28 17:21
 * @version: 1.0
 */
public class ServiceImpl implements Service {
    private JdbcTemplate jdbcTemplate;

    public void setDataSource(DataSource dataSource){
        this.jdbcTemplate=new JdbcTemplate(dataSource);
    }
    @Override
    public void save(Transport transport) {

    }

    @Override
    public List<Transport> getTransports() {
//        jdbcTemplate.update();
//        jdbcTemplate.query();
//        jdbcTemplate.execute();

        return jdbcTemplate.query("select * from transport where task_no='TK18CAF86DC1101353'",new TransportMapper());
    }
}
